package com.shiguiwu.springmybatis.algorithm.linkedlist;

/**
 * @description: 测试
 * @author: stone
 * @date: Created by 2021/3/4 11:48
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.linkedlist
 */
public class LinkedListTests {

    public static void main(String[] args) {
        SingleLinkedList singleLinkedList = new SingleLinkedList();
//        int length = singleLinkedList.length();
        SingleLinkedList.HeroNode node = new SingleLinkedList.HeroNode(1, "宋江", "");
        SingleLinkedList.HeroNode node1 = new SingleLinkedList.HeroNode(2, "吴用", "智多星");
        SingleLinkedList.HeroNode node2 = new SingleLinkedList.HeroNode(5, "林冲", "豹子头");
        SingleLinkedList.HeroNode node3 = new SingleLinkedList.HeroNode(4, "鲁智深", "");


        SingleLinkedList.HeroNode node11 = new SingleLinkedList.HeroNode(2, "吴用1", "智多星1");

        singleLinkedList.add(node);
        singleLinkedList.add(node1);
        singleLinkedList.add(node11);
        singleLinkedList.add(node2);

        singleLinkedList.add(node3);

        //singleLinkedList.addBySort(node);
        //singleLinkedList.length();
        //singleLinkedList.addBySort(node1);
        //singleLinkedList.addBySort(node2);
//        singleLinkedList.length();
//        singleLinkedList.addBySort(node3);
        singleLinkedList.deleteRepeat(node);

        singleLinkedList.print();

//        System.out.println(length);
        System.out.println("================================================");
        SingleLinkedList.HeroNode node5 = new SingleLinkedList.HeroNode(5, "林冲2", "豹子头2");
//        singleLinkedList.update(node5);

        singleLinkedList.print();
        System.out.println("================================================");
        //singleLinkedList.delete(7);
//        singleLinkedList.delete(1);
//        singleLinkedList.delete(2);
//        singleLinkedList.delete(4);
//        singleLinkedList.delete(4);
        System.out.println("================================================");
        singleLinkedList.print();

        SingleLinkedList.HeroNode lastIndexNode = singleLinkedList.findLastIndexNode(-3);

        System.out.println(lastIndexNode);

        System.out.println("================================================");
        singleLinkedList.reverse();
//        singleLinkedList.print();

        System.out.println("================================================");
        singleLinkedList.reversePrint();

    }
}
